package uy.com.cimarron.its.web.beans.user;

import java.io.IOException;

import javax.faces.bean.ManagedBean;
import javax.faces.context.FacesContext;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import uy.com.cimarron.its.web.beans.commons.BasicBean;
import uy.com.cimarron.its.web.beans.commons.BasicSecurity;

@Controller
@ManagedBean(name=BasicBean.LOGOUT_BEAN)
@Scope(BasicBean.SESSION)
public class LogoutBean extends BasicSecurity {
	
	
	private static final long serialVersionUID = 6259779722035798575L;

	public void logout() throws IOException{
		Subject currentUser = SecurityUtils.getSubject();
		currentUser.logout();
		FacesContext.getCurrentInstance().getExternalContext().redirect("/ITS/pages/layout.jsf");
	}
	
	
	
	

}